<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require '../com.swiss.mooh.dao.impl/CarouselDaoImpl.php';
require '../com.swiss.mooh.service/CarouselServiceImpl.php';
require '../com.swiss.mooh.model/Carousel.php';

$dispatcher = new CarouselDaoImpl();
$caService = new CarouselServiceImpl($dispatcher);


//if (move_uploaded_file($_FILES["centerCaFileName"]["tmp_name"], "../../assets/images/uploads/images/" . $_FILES["centerCaFileName"]["name"])) {
$caObj = new Carousel();
$caObj->setCaID(uniqid());
$caObj->setCaFilePath($_POST['centerCaFileName']);
$caObj->setCaLink($_POST['centerCaLink']);
$caObj->setCaName($_POST['centerCaFileName']);
$caObj->setCaPosition("CENTER");
$result = $caService->createCenterCarousel($caObj);
if ($result == 200) {
    header("Location: ../../manage_carousel_page.php");
    exit();
} else {
    echo $result;
}
//} else {
//    echo "Cannot move file to folder";
//}



